package com.hotec.PROJECT_NAME.config.mybatis;

import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory;
import org.apache.ibatis.reflection.wrapper.ObjectWrapper;

import javax.persistence.Table;

public class MybatisObjectWrapperFactory extends DefaultObjectWrapperFactory {

    @Override
    public boolean hasWrapperFor(Object object) {
        boolean flag = object!=null && object.getClass().getAnnotation(Table.class)!=null ;

        return flag;
    }

    @Override
    public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) {

        return new MybatisBeanWrapper(metaObject , object) ;
    }


}
